package cn.hbu.zlfw.dic.dao.impl;

import org.springframework.stereotype.Repository;

import cn.hbu.zlfw.common.base.dao.impl.BaseDaoImpl;
import cn.hbu.zlfw.common.util.PageModel;
import cn.hbu.zlfw.dic.dao.DicSchoolDao;
import cn.hbu.zlfw.dic.entity.DicPrimarySubject;
import cn.hbu.zlfw.dic.entity.DicSchool;

/**
 * 
 * @ClassName: DicSchoolDaoImpl 
 * @Description: 单位字典表dao接口实现
 * @author 王鹏伟<1223443289@qq.com>
 * @date 2017年11月28日 下午11:51:23 
 * @vsersion:v1.0
 */
@Repository("dicSchoolDao")
public class DicSchoolDaoImpl extends BaseDaoImpl<DicSchool, String> implements DicSchoolDao{
	
	/*
	 * (non-Javadoc)
	 * @see cn.hbu.zlfw.dic.dao.DicSchoolDao#listSchoolsToRoot(cn.hbu.zlfw.common.util.PageModel)
	 */
	@Override
	public PageModel<DicSchool> listSchoolsToRoot(PageModel<DicSchool> pageModel) {
		return this.findListByParams("from DicSchool", null, null, pageModel);
	}

	//通过状态吗去查询一级学科DicPrimarySubject
		@Override
		public String getSchoolByCode(Integer typeCode) {
			return ((DicSchool) this.getSession()
					.createQuery("from DicSchool where typeCode=:typeCode")
					.setParameter("typeCode", typeCode)
					.uniqueResult()).getDescription();
		}
}
